#ifndef NEDIT_H
#define NEDIT_H
#include <QtWidgets>
#include "tools/Gadget.h"
#include "tools/Diary.h"
#include "solar/beacon/Field.h"
#include "solar/trunk/NinsipidView.h"
#include "tools/Reader.h"

class NPlainEdit : public QPlainTextEdit{

    Q_OBJECT

public:

    NPlainEdit(QWidget *parent = nullptr);

    void insertPlainText(const QString &Text);


    void setWheelFontBlock(int block);


    void setBreakAwayFromFollow(bool Enable);


    void addAssistFuncWidget(QWidget *_sec_widget, NT::LOCALTION LOCALTION = NT::LOCALTION_BOTTON_RIGHT);


    void AssistButtonRemove(QWidget *_key_win_);


    void setAssistFuncWidgetMargins(int margins = 3);


    void setAssistFuncWidgetLayoutClock(NT::CST_BRIGHT_SPOT CLOCKWISE);


    QTextBlock firstVisibleBlock();


protected:
    void wheelEvent(QWheelEvent *Event) ;

    void keyPressEvent(QKeyEvent *Event) ;

    void keyReleaseEvent(QKeyEvent *Event) ;

    void paintEvent(QPaintEvent *Event) ;

    void dragEnterEvent(QDragEnterEvent *Event) ;

    void dropEvent(QDropEvent *Event) ;

    void dragLeaveEvent(QDragLeaveEvent *Event) ;

    void mouseReleaseEvent(QMouseEvent *Event) ;

    void enterEvent(QEnterEvent *event) ;

    void leaveEvent(QEvent *event) ;

    void resizeEvent(QResizeEvent *Event) ;

private:
    Extend definfc;
    KEY_ATTRIBUTE RPLKEY;
    QMap<QString, int> RdoMap_Integer;
    QMap<QString, bool> RdoMap_Switch;
    QMap<QString, QMap<QString, QString>> *RGLRLSMAP;
    QList<QString> retentionFoodList;
    QList<QWidget *> addAssistFuncWidgets;
    QList<NT::LOCALTION> addAssistFuncLocations;

    void pushText(const QString &Text);

    void addAssistButtonLayout();

signals:
    void msev_drop(std::pair<bool, QStringList>);
    void msev_rls(bool);
    void msev_wheel(int);
    void msev_etr(bool);
    void pixmap_empty_error(QString);
    void blockTextSend(QString);
    void KeyEvent(QPair<int, QString>);
};


class NLineEdit : public QLineEdit {

    Q_OBJECT

public:

    NLineEdit(QWidget *parent = nullptr);

protected:

    void keyPressEvent(QKeyEvent *Event);


    void keyReleaseEvent(QKeyEvent *Event);


    void dragEnterEvent(QDragEnterEvent *Event);


    void dropEvent(QDropEvent *Event);


    void dragLeaveEvent(QDragLeaveEvent *Event);


    void mouseReleaseEvent(QMouseEvent *Event);


private:
    Extend definfc;
    QMap<QString, int> RdoMap_Integer;
    QMap<QString, bool> RdoMap_Switch;
    QMap<QString, QMap<QString, QString>> *RGLRLSMAP;
    QList<int> SpecialKey = {16777235,16777237,16777234,16777236,16777217,91,93,47,92};

signals:
    void msev_drop(std::pair<bool, QStringList>);
    void msev_rls(bool);
    void msnm_rls(QString);
    void msev_wheel(int);
    void KeyEvent(QPair<int, QString>);
};

#endif
